﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using OrderModule.PublicInterfaces;
using LoggingModule.PublicInterfaces;
using A2DFramework.OSGI;
using OrderModule.PublicInterfaces.Events;
using A2DFramework.OSGI.BundleContexts;

namespace OrderModule
{
    class OrderProcessorImpl : ServiceProvider, IOrderProcessor
    {
        public Guid PlaceOrder(OrderModule.PublicInterfaces.Dtos.OrderDto order)
        {
            BundleContext ctx=BundleContext.Current;

            ILog log = ctx.GetProvidedService<ILog>();
            log.Log("log something...");

            Console.WriteLine("PlaceOrder body");

            Console.WriteLine("------------------------");
            Console.WriteLine(AppDomain.CurrentDomain.FriendlyName);
            Console.WriteLine("------------------------");

            //OrderAddedEvent evt = new OrderAddedEvent();
            //ctx.TriggerEvent<OrderAddedEvent>(evt);

            return Guid.NewGuid();
        }
    }
}
